 
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <title>list</title> 
  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js" type="text/javascript"></script> 
   

  <script type="text/javascript">
        

    $(document).ready(function () {
        getlist(0);
    });

    function formatDateNow(val) {
        if (val === null || val === '') {
            return null;
        }
        else {  
            var d = new Date(parseInt(val.substr(6))); 
            return d;
        }
    }

    function godata(val) {
        if (val == 0) {
            getlist(0);
        } 
        else if (val == 1)
        {
            getlist(1);
        }
    }

    function getlist(param) {
     
        var viewby = '';
        var methodname = 'getdataallmember';

            if (param == 0) {
                viewby = '0';
                methodname = 'getdataallmember';
            }
            else if (param == 1)  
            {
                viewby = '1';
                methodname = 'getdataviewby';
            }

            $.ajax({
                url: '/ifsb.ashx',
                type: 'Get',
                dataType: 'json',
                data: { method: methodname, viewby: viewby },
                success: function (json) {

                    $("#123").empty();

                    for (var i = 0; i < json.length; i++) {

                        var row = '<tr>';

                        row += '<td>' + (parseInt(i) + 1) + '</td>';
                        row += '<td>' + json[i].MemID + '</td>';
                        row += '<td>' + json[i].FirstName + '</td>';
                        row += '<td>' + json[i].LastName + '</td>';
                        row += '<td>' + json[i].Email + '</td>';
                        row += '<td>' + formatDateNow(json[i].Birthdate).toString().substring(0, 24) + '</td>';
                        row += '<td>' + json[i].Ipaddress + '</td>';
                        row += '<td>' + json[i].Curent_Point + '</td>';
                        row += '<td>' + json[i].Curent_Star + '</td>';

                        row += '</tr>';

                        $("table #123").append(row);
                    }
                }
            });
        }
     
  </script>
</head>
  <body>

  <select name="ranking" onchange="godata(this.value)" >
    <option value="0" >view user</option>
   <!-- <option value="1" >view bet today</option>
    <option value="2" >view bet finished</option> -->
</select>


    <table>
      <thead>
        <tr>
          <th> No </th> 
          <th> MemID </th> 
          <th> FirstName </th>
          <th> LastName </th>
          <th> Email </th>
          <th> Birthdate </th>
          <th> Ipaddress </th>
          <th> Curent_Point </th>
          <th> Curent_Star </th> 
        </tr>
      </thead>
            <tbody id="123"> 
      </tbody>
    </table>
    
  </body>
</html>

